In [1]:
from sympy import *
init_printing() #muestra símbolos más agradab
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import numpy as np
R=lambda n,d: Rational(n,d)
In [2]:
x,y=symbols('x,y')
p=plot_implicit(Eq(x**2+y**2,1),xlim=(-10,10),ylim=(-10,10),show=False)
#p.append(plot_implicit(Eq(x**2+y**2,2),xlim=(-2,2),ylim=(-2,2)))
p1=plot_implicit(Eq(x**2+y**2,2),show=False,aspect_ratio=(1,1))
p2=plot_implicit(Eq(x**2+y**2,3),show=False,aspect_ratio=(1,1))
p.append(p1[0])
p.append(p2[0])
p.show()
In [3]:
#Genero las pendientes
L=[N(tan(pi*k/11.0)) for k in range(11)]
p=plot(L[0]*x,(x,-4,4),show=False,ylim=(-4,4),aspect_ratio=(1,1))
#p=plot(L[0]*x,(x,-2,2),show=False,ylim=(-4,4))
for k in range(1,11):
paux=plot(L[k]*x,(x,-4,4),show=False,ylim=(-4,4),aspect_ratio=(1,1))
p.append(paux[0])
p.show()
In [4]:
#Genero los círculos
circ=plot_implicit(Eq(x**2+y**2,0.4*0**2),show=False,aspect_ratio=(1,1))
for r in range(1,6):
circaux=plot_implicit(Eq(x**2+y**2,0.4*r**2),show=False,aspect_ratio=(1,1))
circ.append(circaux[0])
circ.show()
In [5]:
graf=plot_implicit(Eq(x**2+y**2,0.1*0**2),show=False,aspect_ratio=(1,1))
for r in range(11):
grafaux=plot_implicit(Eq(x**2+y**2,0.1*r**2),show=False,aspect_ratio=(1,1))
graf.append(grafaux[0])
paux=plot(L[r]*x,(x,-4,4),show=False,aspect_ratio=(1,1))
graf.append(paux[0])
graf.show()
In [6]:
x,y=symbols('x,y')
# Gráfica de ecuaciones implícitas
grafa=plot_implicit(Eq(x*y,0),show=False,aspect_ratio=(1,1))
for c in range(1,10):
ecuaaux=plot_implicit(Eq(x*y,(-1)**c*c),show=False,aspect_ratio=(1,1))
grafa.append(ecuaaux[0])
for k in range(10):
grafaaux=plot_implicit(Eq(y**2-x**2,(-1)**k*k),show=False,aspect_ratio=(1,1))
grafa.append(grafaaux[0])
grafa.show()
In [7]:
clear all
In [8]:
x,y=symbols('x,y')
# Gráfica de ecuaciones implícitas
grafb=plot_implicit(Eq(y,0),show=False,aspect_ratio=(1,1))
for c in range(1,4):
ecubaux=plot(((-1)**(c+1))*c*x**2,(x,-4,4),show=False,aspect_ratio=(1,1))
grafb.append(ecubaux[0])
for k in range(4):
grafbaux=plot_implicit(Eq(y**2+(x**2)/2.0,k),show=False,aspect_ratio=(1,1))
grafb.append(grafbaux[0])
grafb.show()
In [ ]:
In [9]:
from sympy.plotting import *
x,y,t=symbols('x,y,t')
grafc=plot_implicit(Eq(x*y,0),show=False,aspect_ratio=(1,1),xlim=(-8,8),ylim=(-8,8))
for c in range(1,5):
curvaaux=plot_parametric(c*(1+cos(x))*cos(x),c*(1+cos(x))*sin(x),(x,0,2*pi),show=False,aspect_ratio=(1,1),xlim=(-8,8),ylim=(-8,8))
grafc.append(curvaaux[0])
for k in range(1,5):
curvan=plot_parametric(k*(1-cos(x))*cos(x),k*(1-cos(x))*sin(x),(x,0,2*pi),show=False,aspect_ratio=(1,1),xlim=(-8,8),ylim=(-8,8))
grafc.append(curvan[0])
grafc.show()
In [10]:
grafd=plot_implicit(Eq(x*y,0),show=False,aspect_ratio=(1,1))
for c in range(1,4):
ecudaux=plot(c*exp(x),(x,-4,4),show=False,aspect_ratio=(1,1))
grafd.append(ecudaux[0])
for k in range(1,4):
grafdaux=plot_implicit(Eq((y**2)/(2.0)+x,k),(x,-4,4),show=False,aspect_ratio=(1,1))
grafd.append(grafdaux[0])
grafd.show()
In [ ]:
In [ ]:
In [11]:
###### INCISO a)
graf2=plot_implicit(Eq(x*y,0),show=False,aspect_ratio=(1,1))
for c in range(1,5):
ecu2aux=plot((-1)**c*c*x**4,(x,-4,4),show=False,aspect_ratio=(1,1))
graf2.append(ecu2aux[0])
for k in range(1,4):
graf2aux=plot_implicit(Eq(y**2+(x**2/(4)),k),show=False,aspect_ratio=(1,1))
graf2.append(graf2aux[0])
graf2.show()
###### INCISO b)
n=6
grafn=plot_implicit(Eq(x*y,0),show=False)
for c in range(1,5):
ecunaux=plot((-1)**c*c*x**n,(x,-4,4),show=False,aspect_ratio=(1,1))
grafn.append(ecunaux[0])
for k in range(1,4):
grafnaux=plot_implicit(Eq(y**2+(x**2/(n)),k),show=False,aspect_ratio=(1,1))
grafn.append(grafnaux[0])
grafn.show()
In [12]:
graf5=plot_implicit(Eq(x*y,0),show=False,aspect_ratio=(1,1))
for c in range(-5,5):
graf5aux=plot_implicit(Eq(y**2,4*c*(x+c)),show=False,aspect_ratio=(1,1))
graf5.append(graf5aux[0])
graf5.show()
In [ ]: